<template>
    <div>
        <Card dis-hover :bordered="false" class="ivu-mt">
            <Row :gutter="16" type="flex" class="ivu-mb-16">
                <Col>
                <Input placeholder="请输入姓名/手机号/微信号/唯一身份" v-model="params.keyword" clearable v-width="250"
                       @on-clear="askDatasearch" @on-enter="askDatasearch" ></Input>
                </Col>
                <Col>
                <Select placeholder="部门筛选" v-model="params.unique_id" filterable clearable v-width="150"
                        @on-change="askDatachange">
                    <Option v-for="item in departmentList" :key="item.value" :value="item.unique_id">{{ item.label }}
                    </Option>
                </Select>
                </Col>
                <Col v-if="newData">
                <Select placeholder="联系人员" v-model="params.contact_id" filterable clearable v-width="150"
                        @on-change="askDatachange">
                    <Option v-for="item in contact_member" :key="item.value" :value="item.value">{{ item.label }}
                    </Option>
                </Select>
                </Col>
                <Col>
                <Select placeholder="对话方式" v-model="params.dialog_mode_id" clearable v-width="150"
                        @on-change="askDatachange">
                    <Option v-for="item in dialogList" :key="item.value" :value="item.value">{{ item.label }}
                    </Option>
                </Select>
                </Col>
                <Col>
                <DatePicker :editable="false" type="daterange" v-model="timedate" :options="options" placeholder="请选择日期"
                            @on-change="askDatatime">
                </DatePicker>
                </Col>
                <Col v-if="booltimeButton">
                <Button @click="timeButtons(10)" :type="timeButton==10?'primary':'default'" :ghost="timeButton==10" class="ivu-mr-8">近10天</Button>
                <Button @click="timeButtons(30)" :type="timeButton==30?'primary':'default'" :ghost="timeButton==30" class="ivu-mr-8">近30天</Button>
                <Button @click="timeButtons(90)" :type="timeButton==90?'primary':'default'" :ghost="timeButton==90">近90天</Button>
                </Col>
                <Col style="display: flex;align-items: center;justify-content: center;">
                <CheckboxGroup @on-change="checkbox3">
                    <Checkbox label="重复"></Checkbox>
                </CheckboxGroup>
                <CheckboxGroup @on-change="checkbox4">
                    <Checkbox label="手机号"></Checkbox>
                </CheckboxGroup>
                <CheckboxGroup v-if="ceshiButton" @on-change="checkbox5">
                    <Checkbox label="测试"></Checkbox>
                </CheckboxGroup>
                </Col>
                <Col>
                <Button v-hasC="{
                            name: 'v1-clue-user-export-grab',
                            flag: 'v1/clue/user/export-grab',
                        }" type="primary" class="ivu-mr-8" :disabled="total === 0" :loading="buttonloading"
                        @click="clickexport">{{ buttonloading ? "正在导出" : "导出" }}</Button>
                <Button type="primary" v-if="buttonbool&&route==$route.path" class="ivu-mr-8" @click="clickexports">
                    下载
                </Button>
                </Col>
            </Row>
            <div class="ivu-clearfix"></div>
            <Table highlight-row ref="table" :columns="columns" :max-height="600" :data="list" :loading="loading"
                   size="small">
                <template slot-scope="{ row }" slot="info">
                    <a @click="openInfo(row)">{{ row.info }}</a>
                </template>
                <template slot-scope="{ row }" slot="contact_time">
                    <span>{{$Date().diff($Date(row.contact_time),'day')}}</span>
                </template>
                <template slot-scope="{ row }" slot="mobile">
                    <span v-if="row.mobile !== ''">{{ row.mobile }}</span>
                    <Divider type="vertical" v-if="row.mobile && row.wechat_num" ></Divider>
                    <span v-if="row.wechat_num !== ''">{{
                        row.wechat_num
                    }}</span>
                </template>
                <template slot-scope="{ row }" slot="operation">
                    <a v-hasC="{
                        name: 'clue-user-info4',
                        flag: 'v1/clue/user/info',
                    }" @click="openedits(row)" v-if="+row.type !== 4">联系</a>
                    <span class="person" v-else>{{ row.contact_name }}</span>
                    <Divider type="vertical" v-if="row.contact_name||row.repeat_type === '1'" v-hasC="{
                        name: 'v1-patient-index-repeat-list6',
                        flag: 'v1/patient/index/repeat-list',
                    }" ></Divider>
                    <a v-if="row.repeat_type === '1'" v-hasC="{
                        name: 'v1-patient-index-repeat-list6',
                        flag: 'v1/patient/index/repeat-list',
                    }" @click="repeatData(row)">重复</a>
                </template>
                <template slot-scope="{ row }" slot="dialog_mode">
                    <span>
                        {{ row.dialog_mode === 'E聊' || row.dialog_mode === '快商通'? row.dialog_mode + (row.user_real_name ? '(' : '') + row.user_real_name + (row.user_real_name ? ')' : '') : row.dialog_mode }}
                    </span>
                </template>
                <template slot-scope="{ row }" slot="state">
                    <div v-if="row.clue_status_name">
                        <Tag v-if="row.type === 1" color="warning">{{
                            row.clue_status_name
                        }}</Tag>
                        <Tag v-else-if="row.type === 2" color="primary">{{
                            row.clue_status_name
                        }}</Tag>
                        <Tag v-else-if="row.type === 3" color="default">{{
                            row.clue_status_name
                        }}</Tag>
                        <Tag v-else-if="row.type === 4" color="success">{{
                            row.clue_status_name
                        }}</Tag>
                        <Tag v-else>{{ row.clue_status_name }}</Tag>
                    </div>
                </template>
            </Table>
            <div class="ivu-mt ivu-text-center">
                <Page show-total show-elevator show-sizer :total="total" :current.sync="params.page"
                      :page-size="params.pageSize" :page-size-opts="pageOpts" @on-change="changepage"
                      @on-page-size-change="changepageSize" ></Page>
            </div>
        </Card>
        <!--线索弹框-->
        <Modal ref="contact" title="联系线索客户" v-model="showedit" transfer :styles="{'z-index': 1500}" :mask-closable="false" width="1100"
               @on-cancel="canceledit('formItem')">
            <Row>
                <Col span="11">
                <DescriptionList :col="2" :gutter="0">
                    <Description term="基本信息：">
                        {{ info.user_name }}
                        {{ info.gender_str }}
                        <span v-if="info.age">
                            {{ info.age }}岁
                        </span>
                    </Description>
                    <Description term="手机号：">
                        <template>{{ info.mobile }}</template>
                    </Description>
                    <Description term="微信号：">
                        <template>{{ info.wechat_num }}</template>
                        <Tag class="ivu-ml-8" v-if="info.is_add" color="success">已添加</Tag>
                    </Description>
                    <Description term="抖音号：">
                        <template>{{ info.dy_num }}</template>
                    </Description>
                    <Description term="搜索词：">
                        <div style="word-break:break-all">
                            {{ info.search_key }}
                        </div>
                    </Description>
                    <Description term="部位：">
                        <template v-for="(item,index) in info.body_parts_arr">
                            <span :key="index">{{ index==0?item:`，${item}` }}</span>
                        </template>
                    </Description>
                </DescriptionList>
                <Tabs v-model="name" :animated="false" name="a">
                    <TabPane label="聊天记录" name="name1" tab="a" >
                        <div style="max-height:443px;overflow: auto; display: grid;" v-if="info && info.dialog_mode !== 'E聊'">
                            <p>{{ info.message }}</p>
                            <Row type="flex" style="background: #eee;">
                                <Col v-for="(item,index) in info.img" :key="index" class="ivu-ml-8">
                                <img @click="bigsee(index, info.img)" style="width:120px;height:120px;object-fit: cover;padding: 6px;" :src="item">
                                </Col>
                            </Row>
                        </div>
                        <div v-else>
                            <div v-if="chartList.length">
                                <div style="max-height: 380px; overflow: auto;">
                                    <template v-for="(item, index) in chartList">
                                        <div :key="index" style="margin-top:10px">
                                            <div style="margin-bottom: 6px;font-size:13px;color:#a7a3a3">
                                                <span>{{
                                                    item.sender_type === "0"
                                                        ? "客服 - " +
                                                            (item.user_real_name
                                                                ? item.user_real_name
                                                                : item.from_id)
                                                        : "患者"
                                                }}</span>
                                                <span style="margin-left:30px">{{
                                                    item.receive_time
                                                }}</span>
                                            </div>
                                            <img @click="seeBIg(item.message)" style="width: 100px;object-fit: cover;"
                                                 v-if="item.message.startsWith('https://')" :src=" item.message" alt="">
                                            <div v-else style="font-weight:600;width:300px;word-break:break-all ">{{
                                                item.message
                                            }}</div>
                                        </div>
                                    </template>
                                </div>
                            </div>
                        </div>
                    </TabPane>
                    <TabPane label="联系记录" name="name2" tab="a">
                        <div
                            style="height: 420px; overflow: auto;box-sizing: border-box;">
                            <Timeline>
                                <TimelineItem v-for="(item,index) in infoData.contact" :key="index">
                                    <p style="font-weight: 600;" class="time">
                                        {{ item.created_at }}
                                    </p>
                                    <div v-if="item.contact_type == 'wechat'">
                                        <p class="content ivu-pt-8 ivu-pb-8">微信好友,已添加。</p>
                                        <p class="content ivu-pt-8 ivu-pb-8">{{item.nickname}}</p>
                                    </div>
                                    <div v-if="item.contact_type == 'call'">
                                        <p class="content ivu-mt-16" style="display: flex;align-items: flex-start;flex-direction: column;">
                                            <audio :id="`audio-${index}`" class="audio" v-if="item.file_url" controls :src="item.file_url"
                                                   @play="audioplays(item.speed,index)"></audio>
                                            <span v-if="item.file_url != ''" class="ivu-mt-16">
                                                播放倍速：
                                                <RadioGroup v-model="item.speed" @on-change="changeaudio(item.speed, index)">
                                                    <Radio :label="items.id" v-for="items in RadioGroup" :key="items.id">{{items.name}}</Radio>
                                                </RadioGroup>
                                            </span>
                                        </p>
                                    </div>
                                    <p class="content ivu-pt-8 ivu-pb-8">{{ item.remark }}</p>
                                    <p class="consultant">
                                        <span class="c-inr ivu-mr-8">{{
                                            item.realname
                                        }}</span>
                                        <Badge v-if="item.status_name === '未联系上'" status="success"
                                               :text="item.status_name" ></Badge>
                                        <Badge v-if="item.status_name === '无效'" status="processing"
                                               :text="item.status_name" ></Badge>
                                        <Badge v-if="item.status_name === '转客户'" status="warning"
                                               :text="item.status_name" ></Badge>
                                        <Badge v-if="item.status_name === '新数据'" status="default"
                                               :text="item.status_name" ></Badge>
                                    </p>
                                </TimelineItem>
                            </Timeline>
                        </div>
                    </TabPane>
                </Tabs>
                <!-- <Row :gutter="16" style="max-height: 340px; overflow: auto;">
                    <Col span="8" v-for="(item, index) in info.upload_talk_img" :key="index"><img
                        style="height: 330px; width: 186px; object-fit: cover;" @click="
                                    (imgNames = `${info.images_host}${item}`),
                                        (visibles = true)
                                " :src="`${info.images_host}${item}`" /></Col>
                </Row> -->
                </Col>
                <Col span="13">
                <div style="padding-left: 20px;box-sizing: border-box;border-left: 1px solid #9b9ca0;">
                    <Form label-position="top" :model="contactData" ref="formItem" :rules="createRuless">
                        <FormItem label="联系结果">
                            <RadioGroup v-model="contactData.clue_status_id" @on-change="changeclue">
                                <Radio :label="item.value" v-for="item in clueList" :key="item.value"
                                       v-if="+item.value !== 9">
                                    <span>{{ item.label }}</span>
                                </Radio>
                            </RadioGroup>
                        </FormItem>
                        <FormItem label="联系方式" v-if="contactData.clue_status_id == 7"  prop="contact_type">
                            <RadioGroup v-model="contactData.contact_type">
                                <Radio label="1"><span>微信</span></Radio>
                                <Radio label="2"><span>电话</span></Radio>
                                <Radio label="3"><span>其他</span></Radio>
                            </RadioGroup>
                        </FormItem>
                        <template v-if="contactData.clue_status_id === '8'">
                            <Row :gutter="24">
                                <Col span="5">
                                <FormItem label="姓名">
                                    <Input v-model="contactData.userName" placeholder="请输入姓名" ></Input>
                                </FormItem>
                                </Col>
                                <Col span="7">
                                <FormItem label="性别">
                                    <RadioGroup v-model="contactData.sex">
                                        <Radio :label="0">未知</Radio>
                                        <Radio :label="1">男</Radio>
                                        <Radio :label="2">女</Radio>
                                    </RadioGroup>
                                </FormItem>
                                </Col>
                                <Col span="4">
                                <FormItem label="年龄" prop="age">
                                    <InputNumber :max="100" :min="1" v-model="contactData.age"></InputNumber>
                                </FormItem>
                                </Col>
                            </Row>
                            <Row :gutter="24">
                                <Col span="8">
                                <FormItem label="手机号" prop="mobile">
                                    <Input v-model="contactData.mobile"
                                           @on-keyup="contactData.mobile=contactData.mobile.replace(/\s+|[\r\n]/g,'')"
                                           @on-blur="
                                               telrepeat(contactData.mobile)
                                           " placeholder="请输入手机号" ></Input>
                                    <div style="color:#ff9900;font-size:18px" v-if="patientStatus">！老患者到诊</div>
                                </FormItem>
                                </Col>
                                <Col span="8">
                                <FormItem label="微信号">
                                    <Input v-model="contactData.weChartNum"
                                           @on-keyup="contactData.weChartNum=contactData.weChartNum.replace(/\s+|[\r\n]/g,'')"
                                           @on-blur="WXrepeat(contactData.weChartNum)" placeholder="请输入微信号" ></Input>
                                </FormItem>
                                </Col>
                                <Col span="8">
                                <FormItem label="一级渠道" prop="channel_id">
                                    <Select v-model="contactData.channel_id" filterable clearable @on-change="changechannel(contactData.channel_id)">
                                        <Option v-for="item in channelList" :value="item.value" :key="item.value">{{item.label }}</Option>
                                    </Select>
                                    <!-- <TreeSelect v-width="150" v-model="contactData.channel_id" :data="channelList" filterable clearable placeholder="来源渠道" /> -->
                                </FormItem>
                                </Col>
                                <Col span="8">
                                <FormItem label="二级渠道" prop="subdivided_channels_id">
                                    <Select v-model="contactData.subdivided_channels_id" filterable clearable v-if="childchannelshow">
                                        <Option v-for="item in child_source_channel" :value="item.value" :key="item.value">{{
                                        item.label }}</Option>
                                    </Select>
                                </FormItem>
                                </Col>
                            </Row>
                            <Row :gutter="24">
                                <Col span="8">
                                <FormItem label="一级病种" prop="oneDiseases">
                                    <Select placeholder="请选择一级病种" v-model="contactData.oneDiseases" clearable
                                            @on-clear="clearOne" :key="Math.random() * 10 + 1" @on-change="changeOne">
                                        <Option v-for="item in diseasesArr1" :value="item.value" :key="item.value">{{
                                        item.label }}</Option>
                                    </Select>
                                </FormItem>
                                </Col>
                                <Col span="8">
                                <FormItem label="二级病种" prop="twoDiseases" :rules="twoRules"
                                          v-show="diseasesArr2.length>0">
                                    <Select :key="Math.random() * 10 + 1" placeholder="请选择二级病种"
                                            v-model="contactData.twoDiseases" clearable>
                                        <Option v-for="item in diseasesArr2" :value="item.value" :key="item.value">{{
                                        item.label }}</Option>
                                    </Select>
                                </FormItem>
                                </Col>
                                <Col span="8">
                                <FormItem label="患者状态" prop="patientStatus">
                                    <Select placeholder="请选择" v-model="contactData.patientStatus" clearable>
                                        <Option v-for="item in patientStatusArr" :value="item.value" :disabled="
                                            +item.is_select === 0
                                        " :key="item.value">{{ item.label }}</Option>
                                    </Select>
                                </FormItem>
                                </Col>
                            </Row>
                            <Row :gutter="24">
                                <Col span="10">
                                <FormItem label="部位" prop="bodyPart" :rules="bodyPartRule">
                                    <TreeSelect :max-tag-count="2" v-model="contactData.bodyPart" :data="postList"
                                                clearable multiple ></TreeSelect>
                                </FormItem>
                                </Col>
                                <Col span="10">
                                <FormItem label="城市" required>
                                    <jgcheckcity ref="checkcity" @cityvalue="cityvalue" v-model="city_id" :name="`grap`"></jgcheckcity>
                                </FormItem>
                                </Col>
                            </Row>
                            <template v-if="contactData.patientStatus === '2' || contactData.patientStatus === '1'">
                                <FormItem label="下次回访时间" prop="day">
                                    <Row :gutter="16" type="flex">
                                        <Col>
                                        <InputNumber :formatter="$inputday" :step="1" :min="0"
                                                     v-model.number="contactData.day" @on-change="
                                                         blurday(contactData.day)
                                                     ">
                                        </InputNumber>
                                        </Col>
                                        <Col>天后</Col>
                                        <Col>
                                        <DatePicker :editable="false" :options="optionss" type="date"
                                                    v-model="DatePicker" @on-change="
                                                        changeday(DatePicker)
                                                    " placeholder="请输入回访时间">
                                        </DatePicker>
                                        </Col>
                                    </Row>
                                </FormItem>
                            </template>
                            <template v-if="contactData.patientStatus === '1'">
                                <FormItem label="预到时间" prop="day1">
                                    <Row :gutter="16" type="flex">
                                        <Col>
                                        <InputNumber :formatter="$inputday" :step="1" :min="0" v-model.number="
                                            contactData.day1
                                        " @on-change="
                                            blurday1(contactData.day1)
                                        ">
                                        </InputNumber>
                                        </Col>
                                        <Col>天后</Col>
                                        <Col>
                                        <DatePicker :editable="false" :options="optionss" type="date"
                                                    v-model="DatePicker1" @on-change="
                                                        changeday1(DatePicker1)
                                                    " placeholder="请输入预约时间">
                                        </DatePicker>
                                        </Col>
                                    </Row>
                                </FormItem>
                            </template>
                        </template>
                        <FormItem label="备注" prop="remark" :rules="remarkRule">
                            <Input type="textarea" placeholder="请备注原因" v-model="contactData.remark"
                                   :autosize="{ minRows: 2, maxRows: 8 }" ></Input>
                        </FormItem>
                    </Form>
                </div>
                </Col>
            </Row>
            <div slot="footer">
                <Button @click="canceledit('formItem')">取消</Button>
                <Button :loading="subloading" type="primary" @click="handlesearch('formItem')">确定</Button>
            </div>
        </Modal>
        <Modal ref="contact" :footer-hide="true" title="线索详细" v-model="showInfoModal" :mask-closable="true" width="1100" @on-cancel="closeEl">
            <DescriptionList :col="2">

                <Description term="基本信息：">
                    {{ info.user_name }}
                    {{ info.gender_str }}
                    <span v-if="info.age">
                        {{ info.age }}岁
                    </span>
                </Description>
                <Description term="手机号：">
                    <template>{{ info.mobile }}</template>
                </Description>
                <Description term="微信号：">
                    <template>{{ info.wechat_num }}</template>
                    <Tag class="ivu-ml-8" v-if="info.is_add" color="success">已添加</Tag>
                </Description>
                <Description term="抖音号：">
                    <template>{{ info.dy_num }}</template>
                </Description>
                <Description term="搜索词：">
                    <div style="word-break:break-all">
                        {{ info.search_key }}
                    </div>
                </Description>
                <Description term="部位：">
                    <template v-for="(item,index) in info.body_parts_arr">
                        <span :key="index">{{ index==0?item:`，${item}` }}</span>
                    </template>
                </Description>
            </DescriptionList>
            <Row>
                <Col span="12">
                <DescriptionList :col="1" v-if="infoData.info && infoData.info.dialog_mode !== 'E聊'">
                    <Description term="聊天记录：">
                        <template>
                            <div style="max-height:500px;overflow: auto; display: grid;">
                                <p>{{ infoData.info.message }}</p>
                                <Row type="flex"style="background: #eee;">
                                    <Col v-for="(item,index) in infoData.info.img" :key="index" class="ivu-ml-8">
                                    <img @click="bigsee(index, infoData.info.img)" style="width:140px;height:140px;object-fit: cover;padding: 6px;" :src="item">
                                </Col>
                                </Row>
                            </div>
                        </template>
                    </Description>
                </DescriptionList>
                <DescriptionList :col="1" v-else>
                    <Description term="聊天记录：">
                        <div v-if="chartList.length">
                            <div style="height: 500px; overflow: auto;">
                                <template v-for="(item, index) in chartList">
                                    <div :key="index" style="margin-top:10px">
                                        <div style="margin-bottom: 6px;font-size:13px;color:#a7a3a3">
                                            <span>{{
                                                item.sender_type === "0"
                                                    ? "客服 - " +
                                                        (item.user_real_name
                                                            ? item.user_real_name
                                                            : item.from_id)
                                                    : "患者"
                                            }}</span>
                                            <span style="margin-left:30px">{{
                                                item.receive_time
                                            }}</span>
                                        </div>
                                        <img @click="seeBIg(item.message)" style="width: 100px;object-fit: cover;"
                                             v-if="item.message.startsWith('https://')" :src=" item.message" alt="">
                                        <div v-else style="font-weight:600;width:300px;word-break:break-all ">{{
                                            item.message
                                        }}</div>
                                    </div>
                                </template>
                            </div>
                            <Divider></Divider>
                        </div>
                    </Description>
                </DescriptionList>
                </Col>
                <Col span="12">
                <template v-if="infoData.info">
                    <Row :gutter="16" style="max-height: 340px; overflow: auto;">
                        <Col span="8" v-for="(item, index) in infoData.info.upload_talk_img" :key="index"><img style="
                                        height: 330px;
                                        width: 186px;
                                        object-fit: cover;
                                    " @click="
                                        (imgNames = `${infoData.info.images_host}${item}`),
                                            (visibles = true)
                        " :src="`${infoData.info.images_host}${item}`" ></Col>
                    </Row>
                </template>
                <template>
                    <div
                        style="margin-top: 15px;height: 500px; overflow: auto;padding-left: 25px;box-sizing: border-box;border-left: 1px solid rgb(167, 163, 163);">
                        <Timeline>
                            <TimelineItem v-for="item in infoData.contact" :key="item.id">
                                <p style="font-weight: 600;" class="time">
                                    {{ item.created_at }}
                                </p>
                                <p class="content ivu-pt-8 ivu-pb-8">{{ item.remark }}</p>
                                <p class="consultant">
                                    <span class="c-inr ivu-mr-8">{{
                                        item.realname
                                    }}</span>
                                    <Badge v-if="item.status_name === '未联系上'" status="success"
                                           :text="item.status_name" ></Badge>
                                    <Badge v-if="item.status_name === '无效'" status="processing"
                                           :text="item.status_name" ></Badge>
                                    <Badge v-if="item.status_name === '转客户'" status="warning"
                                           :text="item.status_name" ></Badge>
                                    <Badge v-if="item.status_name === '新数据'" status="default"
                                           :text="item.status_name" ></Badge>
                                </p>
                            </TimelineItem>
                        </Timeline>
                    </div>
                </template>
                </Col>
            </Row>
        </Modal>
        <Modal title="重复数据" :mask-closable="false" footer-hide :width="80" v-model="repeatDatas">
            <Table :max-height="400" :columns="repeatColumns" :data="repeatDataList" :loading="graploading">
                <template slot="user_name" slot-scope="{ row }">
                    <span>{{ row.user_name }}</span>
                    <span>{{
                        row.gender === "0"
                            ? "未知"
                            : row.gender === "1"
                                ? "女"
                                : "男"
                    }}</span>
                    <span>{{ row.age }}</span>
                </template>
                <template slot="mobile" slot-scope="{ row }">
                    <span v-if="
                        +repeatInfo.repeat_type === 1 ||
                            +repeatInfo.repeat_type === 3
                    " :class="
                        row.mobile && row.mobile === repeatInfo.mobile
                            ? 'repeatColor'
                            : null
                    ">
                        {{ row.mobile }}
                    </span>
                    <span v-else>{{ row.mobile }}</span>
                </template>
                <template slot="dialog_mode" slot-scope="{ row }">
                    <span>
                        {{ row.dialog_mode}}
                    </span>
                </template>
                <template slot="wechat_num" slot-scope="{ row }">
                    <span v-if="
                        +repeatInfo.repeat_type === 2 ||
                            +repeatInfo.repeat_type === 3
                    " :class="
                        row.wechat_num &&
                            row.wechat_num === repeatInfo.wechat_num
                            ? 'repeatColor'
                            : null
                    ">
                        {{ row.wechat_num }}
                    </span>
                    <span v-else>{{ row.wechat_num }}</span>
                </template>
            </Table>
        </Modal>
        <Modal v-model="imgModel" footer-hide>
            <p slot="header">
                查看大图
            </p>
            <img :src="src" style="width: 100%;object-fit: cover;" >
        </Modal>
        <bigimgmodal ref="bigimgmodal"></bigimgmodal> <!-- 添加站点 -->
    </div>
</template>
<script>
    import {
        clueusergrablist,
        clueuserinfoNew,
        clueusercontact,
        patientindexsearchcity,
        grapRepeatData,
        EweCharts,
        patientindexsearchmobile,
        clueuserexportgrab,
        repeatbaiyou,
        patientindexsearchchildchannel
    } from '@api/hqapi';
    import dayjs from 'dayjs';
    import { mapState, mapMutations } from 'vuex';
    import mixins from '@/mixins/mixins';
    import bigimgmodal from './bigimgmodal';
    // import jgcheckcity from '@/components/checkcity';
    let lodash = require('lodash');
    export default {
        components: { bigimgmodal },
        name: 'grap',
        mixins: [mixins],
        props: {
            booltimeButton: { type: Boolean, default: true },
            clue_status_id: { type: [String, Number], default: '' },
            ceshiButton: { type: Boolean, default: false },
            columnsHeader: { type: [String, Number], default: 0 },
            customer: { type: Boolean, default: false }
        },
        data() {
            const validateMobile = (rule, value, callback) => {
                if(value === '') {
                    callback();
                }else {
                    let reg = /^\d{10,12}$/;
                    if(reg.test(value)) {
                        callback();
                    }else {
                        callback(new Error('请输入正确的联系号码'));
                    }
                }
            };
            const validateChannel = (rule, value, callback) => {
                if(value === '') {
                    callback(new Error('请选择渠道'));
                }else {
                    callback();
                }
            };
            return {
                RadioGroup: [
                    { id: 0.5, name: '0.5' },
                    { id: 0.75, name: '0.75' },
                    { id: 1, name: '1.0' },
                    { id: 1.5, name: '1.5' },
                    { id: 1.75, name: '1.75' },
                    { id: 2, name: '2.0' }
                ],
                audioindex: null,
                audioplay: null,
                newData: true,
                name: 'name1',
                timeButton: 10,
                firstTime: true,
                loadings: false,
                graploading: false,
                repeatColumns: Object.freeze([
                    {
                        title: '基本信息',
                        slot: 'user_name'
                    },
                    {
                        title: '手机号',
                        slot: 'mobile'
                    },
                    {
                        title: '微信',
                        slot: 'wechat_num'
                    },
                    {
                        title: '录入人员',
                        key: 'realname'
                    },
                    {
                        title: '录入时间',
                        key: 'created_at'
                    }
                ]),
                operationMember: [],

                edit: false,
                list: [],
                eChartPage: 1,
                eChartTotal: 0,
                chartList: [],
                repeatInfo: {},
                repeatDatas: false,
                repeatDataList: [],
                contactData: {
                    id: undefined,
                    clue_status_id: '8',
                    remark: '',
                    mobile: '',
                    bodyPart: [],
                    weChartNum: '',
                    day: 1,
                    day1: 0,
                    type: 1,
                    userName: '',
                    contact_type: '',
                    channel_id: '',
                    subdivided_channels_id: '',
                    age: 0,
                    birthday: '',
                    sex: '',
                    city_id: '',
                    oneDiseases: '',
                    twoDiseases: '',
                    patientStatus: '2'
                },
                preBirthday: '',
                diseasesArr2: [],
                diseasesArr1: [],
                contact: [],
                city_id: [],
                contactDatas: true,
                channelList: [],
                clueList: [],
                optionscity: [],
                departmentList: [],
                loadingcity: false,
                createRuless: {
                    mobile: [{ validator: validateMobile, trigger: 'blur' }],

                    contact_type: [
                        {
                            required: true,
                            message: '请选中联系方式'
                        }
                    ],
                    remark: [
                        {
                            required: true,
                            type: 'string',
                            message: '请输入备注原因',
                            trigger: 'blur'
                        }
                    ],
                    age: [
                        {
                            required: true,
                            message: '请填写年龄',
                            type: 'number',
                            trigger: 'blur,change'
                        }
                    ],
                    city_id: [
                        {
                            required: true,
                            message: '请选择城市',
                            trigger: 'change'
                        }
                    ],
                    channel_id: [
                        {
                            required: false,
                            // validator: validateChannel,
                            message: '请选择一级渠道',
                            trigger: 'change,blur'
                        }
                    ],
                    subdivided_channels_id: [
                        {
                            required: false,
                            // validator: validateChannel,
                            message: '请选择二级渠道',
                            trigger: 'change,blur'
                        }
                    ],
                    oneDiseases: [
                        {
                            required: true,
                            message: '请选择一级病种',
                            trigger: 'change'
                        }
                    ],

                    twoDiseases: [
                        {
                            required: true,
                            message: '请选择二级病种',
                            trigger: 'change'
                        }
                    ],
                    patientStatus: [
                        {
                            required: true,
                            message: '请选择患者状态',
                            trigger: 'change'
                        }
                    ],
                    day: [
                        {
                            required: true,
                            type: 'number',
                            message: '请输入回访时间',
                            trigger: 'blur'
                        }
                    ],
                    day1: [
                        {
                            required: true,
                            type: 'number',
                            message: '请输入预约',
                            trigger: 'blur'
                        }
                    ]
                },
                contact_member: [],
                columns: [
                    // { title: "基本信息", key: "info", fixed: "left", width: 130 },
                    { title: '基本信息', slot: 'info', fixed: 'left', width: 150 },

                    { title: '地区', key: 'region', width: 130 },
                    { title: '获取时间', key: 'created_at', width: 160 },
                    { title: '渠道', key: 'source_channel', width: 160 },
                    {
                        title: '联系方式',
                        slot: 'mobile',
                        width: 200
                    },
                    {
                        title: '唯一身份',
                        key: 'visitor_uid',
                        width: 250,
                        ellipsis: true,
                        tooltip: true
                    },
                    { title: '对话方式', slot: 'dialog_mode', width: 140 },
                    {
                        title: '来源页面',
                        key: 'source_page',
                        width: 130,
                        ellipsis: true,
                        tooltip: true
                    },
                    {
                        title: '留言内容',
                        key: 'message',
                        width: 300,
                        ellipsis: true,
                        tooltip: true
                    },
                    {
                        title: '咨询备注',
                        key: 'advisory_remark',
                        minWidth: 120,
                        ellipsis: true,
                        tooltip: true
                    },
                    {
                        title: '联系人员',
                        key: 'contact_name',
                        minWidth: 120,
                        ellipsis: true,
                        tooltip: true
                    },
                    {
                        title: '来源备注',
                        key: 'source_remark',
                        width: 130,
                        ellipsis: true,
                        tooltip: true
                    },
                    // {
                    //     title: "搜索词",
                    //     key: "search_key",
                    //     width: 150,
                    //     ellipsis: true,
                    //     tooltip: true,
                    // },
                    {
                        title: '操作',
                        slot: 'operation',
                        fixed: 'right',
                        width: 130
                    }
                ],
                patientStatusArr: [],
                timedate: [new Date(), new Date()],
                options: {
                    disabledDate(date) {
                        return date && date.valueOf() > Date.now();
                    }
                },
                postList: [],
                imgModel: false,
                src: '',
                optionss: {
                    disabledDate(date) {
                        return (
                            date && date.valueOf() < Date.now() - 24 * 3600 * 1000
                        );
                    }
                },
                info: {},
                infoData: {},
                DatePicker: new Date(new Date().getTime() + 86400000),
                DatePicker1: new Date(new Date().getTime()),
                relus: {},
                showInfoModal: false,
                dialogList: [],
                // 请求参数
                params: {
                    page: 1,
                    pageSize: 10,
                    keyword: '',
                    clue_status_id: '',
                    dialog_mode_id: '',
                    contact_id: '',
                    source_channel_id: '',
                    start_date: new Date(),
                    end_date: new Date(),
                    unique_id: ''
                },
                patientStatus: false,// 是否老患者到诊状态
                child_source_channel: [],
                childchannelshow: true,
            };
        },
        computed: {
            ...mapState('power/inputexportgrap', [
                'buttonloading',
                'exporturl',
                'buttonbool',
                'route'
            ]),
            bodyPartRule() {
                if(this.contactData.oneDiseases === '1') {
                    return {
                        required: true,
                        validator: (rule, value, callback) => {
                            if(value.length) {
                                callback();
                            }else {
                                callback(new Error('请选择部位'));
                            }
                        },
                        trigger: 'change'
                    };
                }else {
                    return {
                        required: false,
                        type: 'array',
                        trigger: 'change'
                    };
                }
            },
            remarkRule() {
                if(this.contactData.clue_status_id === '8') {
                    return {
                        required: false,
                        type: 'string',
                        message: '请输入备注原因',
                        trigger: 'blur'
                    };
                }else {
                    return {
                        required: true,
                        type: 'string',
                        message: '请输入备注原因',
                        trigger: 'blur'
                    };
                }
            },
            twoRules() {
                if(this.diseasesArr2.length) {
                    return {
                        required: true,
                        message: '请选择二级病种',
                        trigger: 'change'
                    };
                }else {
                    return {
                        required: false,
                        message: '请选择二级病种',
                        trigger: 'change'
                    };
                }
            },
            birthdays() {
                if(this.contactData.age) {
                    var year = new Date().getFullYear() - this.contactData.age;
                    return year + '-01' + '-01';
                }
            }
        },
        filters: {
            timeFormat(data) {
                return dayjs(data.created_at * 1000).format('YYYY-MM-DD');
            }
        },
        methods: {
            initials(menuName) {
                // console.log(menuName,1)
                if(this.firstTime) {
                    if(this.booltimeButton) {
                        this.timedate = [this.$Date().subtract(10, 'day'), this.$Date()];
                        this.params.start_date = this.timedate[0];
                        this.params.end_date = this.timedate[1];
                    }
                    if(this.columnsHeader == 1) {
                        let length = this.columns.length - 3;
                        let columnsing = { title: '联系次数', key: 'contact_count', minWidth: 168 };
                        this.columns.splice(length, 0, columnsing);
                    }else if(this.columnsHeader == 2) {
                        let length = this.columns.length - 3;
                        let columnsing1 = { title: '未联系天数', slot: 'contact_time', minWidth: 168 };
                        let columnsing2 = { title: '联系次数', key: 'contact_count', minWidth: 168 };
                        this.columns.splice(length, 0, columnsing1, columnsing2);
                    }
                    this.params.clue_status_id = this.clue_status_id;
                    this.askData();
                    // if(menuName=='grop'){
                       
                    //      this.askData()
                    // }else{
                    //      this.initial()
                    // }
                   
                    this.firstTime = false;
                }
            },
            timeButtons(num) {
                this.timedate = [this.$Date().subtract(num, 'day'), this.$Date()];
                this.params.start_date = this.timedate[0];
                this.params.end_date = this.timedate[1];
                this.timeButton = num;
                this.askData();
            },
            cityvalue(city) {
                this.city_id = city;
                this.contactData.city_id = city.join(',');
                // this.askData();
            },
            ...mapMutations('power/inputexportgrap', [
                'changeLoading',
                'changebool',
                'changeUrl'
            ]),
            clickexport() {
                // this.exportloading = true
                this.changeLoading(true);
                this.exporttext = '正在导出';
                this.changebool(false);
                let params = { ...this.params, route: this.$route.path };
                clueuserexportgrab(params).then(res => {
                    this.exportloading = false;
                    this.exporttext = '导出';
                    // this.buttonbool = true
                });
            },
            clickexports() {
                let urltitle = this.$Setting.apiBaseURL;
                let url = `${urltitle}/${this.exporturl}`;
                window.open(url);
            },
            seeBIg(item) {
                this.src = item;
                this.imgModel = true;
            },
            repeatData(data) {
                this.repeatDatas = true;
                this.graploading = true;
                grapRepeatData({
                    id: data.id
                }).then(res => {
                    this.repeatDataList = res.list;
                    this.repeatInfo = res.info;
                    this.graploading = false;
                });
            },
            /* @函数功能: 初始化 */
            initial() {
                this.funaskData = clueusergrablist;
                this.funupdate = clueusercontact;
                this.paramsedit({ id: 0 });
                this.params.clue_status_id = this.clue_status_id;
                // console.log(this.clue_status_id,'this.clue_status_id')
                // this.askData();
            },
            changeChartPages(e) {
                this.eChartPage = e;
                this.getChartList('infoData');
            },
            clearOne() {
                this.diseasesArr2 = [];
                this.contactData.twoDiseases = '';
            },
            bigsee(index, list) {
                this.$refs.bigimgmodal.initial(index, list);
            },
            getDatas: lodash.debounce(function(params) {
                if(this.optionscity.every(ee => {
                    return ee.label !== params; 
                })) {
                    this.loadingcity = true;
                    patientindexsearchcity({
                        keywords: params
                    }).then(res => {
                        this.loadingcity = false;
                        this.optionscity = Object.freeze(
                            res.list.map(ee => {
                                return {
                                    value: ee.value + ',' + params,
                                    label: ee.label
                                };
                            })
                        );
                        // this.$refs.citySearch.isFocused = false;
                    });
                }
            }, 700),
            remoteMethod(query) {
                if(query !== '') {
                    this.getDatas(query);
                }else {
                    this.optionscity = [];
                }
            },
            openInfo(data) {
                if(data.type == 4) this.openInfos(data);
                else this.openedits(data);
            },
            openedits(data) {
                this.name = 'name1';
                this.openedit(data);
            },
            openInfos(data) {
                clueuserinfoNew({ id: data.id, type: 1 }).then(res => {
                    this.info = res.info;
                    this.infoData = res;
                    this.showInfoModal = true;
                    if(res.info.dialog_mode == 'E聊') {
                        this.getChartList('infoData');
                    }
                });
            },
            closeEl() {
                this.eChartPage = 1;
            },
            getChartList(obj) {
                let params = {};
                switch(obj) {
                    case 'infoData': {
                        params.clue_user_id = this.infoData.info.clue_user_id;
                        // params.page = this.eChartPage
                        // params.pageSize = 10
                        params.page = 0;
                        params.pageSize = 0;
                        params.channel_id = this.infoData.info.dialog_mode_id;
                    } break;
                    case 'info': {
                        // console.log(this.info)
                        params.clue_user_id = this.info.clue_user_id;
                        params.page = 0;
                        params.pageSize = 0;
                        params.channel_id = this.info.dialog_mode_id;
                    } break;
                }
                EweCharts(params).then(res => {
                    this.eChartTotal = res.total;
                    this.chartList = res.list;
                });
            },
            /* @函数功能: 请求数据 */
            askDatas(res) {
                this.list = Object.freeze(res.list);
                this.total = res.total;
                let params = { key: 'grap', total: res.total };
                this.$emit('returntotal', params);
            },
            changeOne(value) {
                if(value) {
                    this.diseasesArr2 = this.diseasesArr1.filter(
                        ee => {
                            return ee.value == value; 
                        }
                    )[0].children;
                    this.contactData.twoDiseases = '';
                    if(!this.diseasesArr2.length) {
                        this.$nextTick(() => {
                            this.$refs.formItem.validateField('twoDiseases');
                        });
                    }
                }
            },
            searchparams() {
                this.timeButton = null;
                if(this.params.keyword !== '') {
                    if(
                        JSON.stringify(this.timedate) !== JSON.stringify(['', ''])
                    ) {
                        let timer = [
                            dayjs(this.timedate[0]).format('YYYY-MM-DD'),
                            dayjs(this.timedate[1]).format('YYYY-MM-DD')
                        ];
                        this.storage.set('clue-grap', timer);
                        this.timedate = ['', ''];
                        this.params.start_date = '';
                        this.params.end_date = '';
                    }
                }else {
                    if(
                        JSON.stringify(this.storage.get('clue-grap')) !==
                        JSON.stringify(['', ''])
                    ) {
                        this.timedate = this.storage.get('clue-grap');
                        this.params.start_date = this.timedate[0];
                        this.params.end_date = this.timedate[1];
                    }
                }
                this.params.page = 1;
                this.params.pageSize = 10;
                this.params.channel_id = '';
                this.params.contact_id = '';
                this.params.unique_id = '';
            },
            paramsedit(row) {
                // console.log(row,'row11')
                clueuserinfoNew({ id: row.id, type: 1 }).then(res => {
                    if(row.id === 0) {
                        this.departmentList = res.department;
                        // this.channelList = res.source_channel;
                        // this.postList = res.body_parts_list
                        // this.clueList = res.clue_status;
                        this.operationMember = res.operation_member;
                        this.contact_member = res.contact_member;
                        this.dialogList = res.dialog;
                    }else {
                        this.clueList = res.clue_status;
                        this.postList = res.body_parts_list;
                        this.channelList = res.source_channel;
                        if(res.contact.length && res.contact[res.contact.length - 1].status_name === '转客户') {
                            this.contactClue = false;
                            this.$Modal.warning({
                                title: '提示消息',
                                content: '该条线索已被转客户，请处理其它线索',
                                onOk: () => {
                                    this.askData();
                                }
                            });
                        }
                        this.contact = res.contact;
                        this.info = res.info;
                        this.infoData = res;
                        if(res.info.dialog_mode == 'E聊') {
                            this.getChartList('info');
                        }
                        this.changechannel(res.info.channel_id);
                        this.contactData.userName = res.info.user_name;
                        this.contactData.sex = res.info.gender;
                        this.contactData.mobile = res.info.mobile;
                        // this.contactData.channel_id = res.info.channel_id + '';
                        this.contactData.channel_id = res.info.channel_id == 0 ? '' : res.info.channel_id + '';
                        this.contactData.subdivided_channels_id = res.info.subdivided_channels_id == 0 ? '' : res.info.subdivided_channels_id + '';
                     
                        this.contactData.weChartNum = res.info.wechat_num;
                        this.contactData.age = +res.info.age ? +res.info.age : null;
                        this.contactData.birthday = res.info.birthday;
                        this.preBirthday = res.info.age;
                        if(
                            res.default_city &&
                            JSON.stringify(res.default_city) !== '{}'
                        ) {
                            this.optionscity = [
                                {
                                    value: res.default_city.city_id,
                                    label: res.default_city.city_name
                                }
                            ];
                            // this.contactData.city = res.default_city.city_id;
                        }
                        this.diseasesArr1 = res.diseases;
                        this.patientStatusArr = res.patient_status;
                        this.DatePicker = new Date(new Date().getTime() + 86400000);
                        for(let item of this.clueList) {
                            if(+item.type === 4) {
                                this.contactData.clue_status_id = item.value;
                            }
                        }
                        this.contactData.id = row.id;
                    }
                });
            },
            askDatatime() {
                this.timeButton = null;
                this.params.start_date = this.timedate[0];
                this.params.end_date = this.timedate[1];
                let timer = ['', ''];
                if(JSON.stringify(this.timedate) !== JSON.stringify(['', ''])) {
                    timer = [
                        dayjs(this.timedate[0]).format('YYYY-MM-DD'),
                        dayjs(this.timedate[1]).format('YYYY-MM-DD')
                    ];
                }
                this.storage.set('clue-grap', timer);
                this.askDatachange();
            },
            blurday(num) {
                this.DatePicker = this.$blurday(num);
            },
            changeday(date) {
                this.contactData.day = this.$changeday(date);
            },
            changeclue(e) {
                for(let item of this.clueList) {
                    if(e === item.value) {
                        if(+item.value === 8) this.contactDatas = true;
                        else this.contactDatas = false;
                    }
                }
            },
            telrepeat(data) {
                let config = {
                    id: this.contactData.id === undefined ? 0 : this.contactData.id,
                    mobile: data
                };
                patientindexsearchmobile(config).then(res => {
                    if(+res.result === 1) {
                        this.$Message.error({
                            duration: 2.5,
                            content: '该手机号码已存在'
                        });
                    }
                });
                repeatbaiyou({mobile: data}).then(res => {
                    // console.log(res,'res')
                    this.patientStatus = res;
                });
            },
            WXrepeat(data) {
                let config = {
                    id: this.contactData.id === undefined ? 0 : this.contactData.id,
                    wechat_id: data
                };

                patientindexsearchmobile(config).then(res => {
                    if(+res.result === 2) {
                        this.$Message.error({
                            duration: 2.5,
                            content: '该微信号已存在'
                        });
                    }
                });
            },
            canceledit(name){
                this.$refs[name].resetFields();
                this.patientStatus = false;
            },
            // 搜索手机号
            handlesearch(name) {
                this.$refs[name].validate(valid => {
                    if(valid) {
                        if(this.contactData.clue_status_id === '8') {
                            let config = {
                                id:
                                    this.contactData.id === undefined
                                        ? 0
                                        : this.contactData.id,
                                mobile: this.contactData.mobile,
                                wechat_id: this.contactData.weChartNum
                            };
                            patientindexsearchmobile(config).then(res => {
                                if(+res.result === 1) {
                                    this.$Modal.confirm({
                                        title: '提示',
                                        content: '<p>该手机号码已存在，是否继续录入?</p>',
                                        onOk: () => {
                                            this.submitedit(name);
                                        },
                                        onCancel: () => {
                                            this.remarksloading = false;
                                        }
                                    });
                                }else if(+res.result === 2) {
                                    this.$Modal.confirm({
                                        title: '提示',
                                        content: '<p>该微信号已存在，是否继续录入?</p>',
                                        onOk: () => {
                                            this.submitedit(name);
                                        },
                                        onCancel: () => {
                                            this.remarksloading = false;
                                        }
                                    });
                                }else if(+res.result === 3) {
                                    this.$Modal.confirm({
                                        title: '提示',
                                        content: '<p>该手机号/微信号已存在，是否继续录入?</p>',
                                        onOk: () => {
                                            this.submitedit(name);
                                        },
                                        onCancel: () => {
                                            this.remarksloading = false;
                                        }
                                    });
                                }else {
                                    this.submitedit(name);
                                }
                            });
                        }else {
                            this.submitedit(name);
                        }
                    }
                });
            },
            paramssubmit() {
                let config = {
                    id: this.contactData.id,
                    clue_status_id: this.contactData.clue_status_id,
                    remark: this.contactData.remark,
                    day: this.contactData.day,
                    type: 1
                };

                let config1 = {
                    id: this.contactData.id,
                    clue_status_id: this.contactData.clue_status_id,
                    remark:
                        this.contactData.clue_status_id === '8'
                            ? ''
                            : this.contactData.remark,
                    day:
                        this.contactData.clue_status_id === '8' &&
                        (this.contactData.patientStatus === '2' ||
                        this.contactData.patientStatus === '1')
                            ? parseInt(new Date(this.DatePicker).getTime() / 1000)
                            : '',
                    type: 1,
                    patient_status_id:
                        this.contactData.clue_status_id === '8'
                            ? this.contactData.patientStatus
                            : '',
                    user_name:
                        this.contactData.clue_status_id === '8'
                            ? this.contactData.userName
                            : '',
                    age:
                        this.contactData.clue_status_id === '8'
                            ? this.contactData.age
                            : '',
                    birthday:
                        this.contactData.clue_status_id === '8'
                            ? this.contactData.age === this.preBirthday
                                ? this.contactData.birthday
                                    ? this.contactData.birthday
                                    : this.birthdays
                                : this.birthdays
                            : '',
                    patient_diseases_id:
                        this.contactData.clue_status_id === '8'
                            ? this.contactData.oneDiseases
                            : '',
                    patient_diseases_child_id:
                        this.contactData.clue_status_id === '8'
                            ? this.contactData.twoDiseases
                            : '',
                    patient_remake:
                        this.contactData.clue_status_id === '8'
                            ? this.contactData.remark
                            : '',
                    city_id: this.contactData.clue_status_id === '8' ? this.contactData.city_id : '',
                    appointment_day:
                        this.contactData.clue_status_id === '8' &&
                        this.contactData.patientStatus === '1'
                            ? parseInt(new Date(this.DatePicker1).getTime() / 1000)
                            : '',
                    gender:
                        this.contactData.clue_status_id === '8'
                            ? this.contactData.sex
                            : '',
                    // city_name: this.contactData.city
                    //     ? this.optionscity.filter(
                    //         (ee) => ee.value === this.contactData.city
                    //     )[0].label
                    //     : "",

                    wechat_num:
                        this.contactData.clue_status_id === '8'
                            ? this.contactData.weChartNum
                            : '',
                    mobile:
                        this.contactData.clue_status_id === '8'
                            ? this.contactData.mobile
                            : '',
                    body_parts_id: this.contactData.clue_status_id === '8'
                        ? this.contactData.bodyPart.join(',')
                        : '',
                    contact_type: this.contactData.clue_status_id == 7 ? this.contactData.contact_type : '',
                    channel_id: this.contactData.clue_status_id === '8'
                        ? this.contactData.channel_id
                        : '',
                    subdivided_channels_id: this.contactData.clue_status_id === '8'
                        ? this.contactData.subdivided_channels_id
                        : ''
                };
                this.logs(this.edits);
                return this.edits ? config : config1;
            },
            paramscancel() {
                this.city_id = [];
                this.contactData = {
                    id: undefined,
                    clue_status_id: '8',
                    remark: '',
                    day: 1,
                    day1: 1,
                    bodyPart: [],
                    type: 1,
                    userName: '',
                    mobile: '',
                    wechat_num: '',
                    channel_id: '',
                    age: 0,
                    contact_type: '',
                    birthday: '',
                    sex: '',
                    city_id: '',
                    oneDiseases: '',
                    twoDiseases: '',
                    patientStatus: '2',
                    subdivided_channels_id: '',
                };
                this.contactDatas = true;
                this.diseasesArr2 = [];
                this.diseasesArr1 = [];
            },
            blurday(num) {
                this.DatePicker = this.$blurday(num);
            },
            changeday(date) {
                this.contactData.day = this.$changeday(date);
            },
            blurday1(num) {
                this.DatePicker1 = this.$blurday(num);
            },
            changeday1(date) {
                this.contactData.day1 = this.$changeday(date);
            },
            checkbox3(e) {
                this.timedate = ['', ''];
                this.timeButton = null;
                this.params.page = 1;
                this.params.have_repeat = e.length;
                this.params.start_date = '';
                this.params.end_date = '';
                this.askData();
            },
            checkbox4(e) {
                this.timedate = ['', ''];
                this.timeButton = null;
                this.params.page = 1;
                this.params.contact_way = e.length;
                this.params.start_date = '';
                this.params.end_date = '';
                this.askData();
            },
            checkbox5(e) {
                this.timedate = ['', ''];
                this.timeButton = null;
                this.params.page = 1;
                this.params.clue_status_id = e.length ? 28 : this.clue_status_id;
                this.params.start_date = '';
                this.params.end_date = '';
                this.askData();
            },
            changeaudio(speed, id) {
                if(this.audioindex === id) {
                    this.audioplay.playbackRate = speed;
                }
            },
            audioplays(speed, id) {
                if(this.audioplay) {
                    if(this.audioindex !== id) {
                        this.audioplay.pause();
                        this.audioplay = null;
                    }
                }
                this.audioindex = id;
                this.audioplay = document.getElementById(`audio-${id}`);
                this.audioplay.playbackRate = speed;
            },
            changechannel(id) {
                this.child_source_channel = [];
                this.contactData.subdivided_channels_id = '';
                patientindexsearchchildchannel({ pid: id }).then(res => {
                    this.child_source_channel = res.list;
                });
            },
        },
        mounted() {
            if(this.$route.path === '/business/newClue/newData') {
                this.newData = false;
                for(let i = 0; i < this.columns.length; i++) {
                    if(this.columns[i].title == '联系人员') {
                        this.columns.splice(i, 1);
                    }
                }
            }
        }
    };
</script>
<style scoped>
/deep/.ivu-modal-mask{
    z-index: 1000 !important;
}
/deep/ .ivu-modal-wrap{
    z-index: 1000 !important;
}
    .person {
        color: #999;
    }

    .repeatColor {
        color: red;
    }
</style>
